Q
How do I get access to the z-buffer?
A
You don't. You aren't guaranteed to be working with hardware that supports a z-buffer, and accessing the z-buffer would force the engine to finish rendering any previously submitted items, which heavily impacts performance.